/*
 * @Date: 2024-06-28 14:24:37
 * @Autor: 叶世超
 * @LastEditors: 叶世超 yesc163@163.com
 * @LastEditTime: 2024-07-01 15:57:19
 * @FilePath: \reslib-web\src\main.ts
 * @Description: 描述
 * @version: 版本
 */
// 引入unocss css
import '@/plugins/unocss'

// 导入全局的svg图标
import '@/plugins/svgIcon'

// 初始化多语言
import { setupI18n } from '@/plugins/vueI18n'
import commonComponents from '@/views/gis/components/install'; //自定义全局组件
// 引入状态管理
import { setupStore } from '@/store'

// 全局组件
import { setupGlobCom } from '@/components'

// 引入 element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import VideoPlayer from '@videojs-player/vue'
import 'video.js/dist/video-js.css'

import VForm3 from '@/../lib/vform/designer.umd.js'
import '../lib/vform/designer.style.css'

// 引入 form-create
import { setupFormCreate } from '@/plugins/formCreate'

// 引入全局样式
import '@/styles/index.scss'

import '@/styles/font.css'

// 引入动画
import '@/plugins/animate.css'

// 路由
import router, { setupRouter } from '@/router'

// 权限
import { setupAuth } from '@/directives'

import { createApp } from 'vue'

import App from './App.vue'

import './permission'

import '@/plugins/tongji' // 百度统计
import Logger from '@/utils/Logger'
import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐患
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import PermissionsPlugin from '@/utils/permissionsPlugin'
// 创建实例
const setupAll = async () => {
  const app = createApp(App)
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
  await setupI18n(app)

  setupStore(app)

  setupGlobCom(app)

  setupFormCreate(app)

  setupRouter(app)

  setupAuth(app)

  await router.isReady()
  app.use(commonComponents)
  app.use(VueDOMPurifyHTML)

  app.use(VideoPlayer)

  app.use(ElementPlus)

  app.use(VForm3)
  app.use(PermissionsPlugin)

  app.mount('#app')
}


setupAll()

Logger.prettyPrimary(`欢迎使用`, import.meta.env.VITE_APP_TITLE)
